﻿<UserControl x:Class="RL.ucInfoRL"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
              d:DesignHeight="200" d:DesignWidth="820" xmlns:my="clr-namespace:RL">
    <UserControl.Resources>
        <CollectionViewSource x:Key="sourceInfo" />
        <CollectionViewSource x:Key="sourceRoutes" />
        <DataTemplate x:Key="cellRoute">
            <!--<ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValue="{Binding Path=RouteTable}" SelectedValuePath="id_route"/> -->
            <ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValuePath="id" SelectedItem="{Binding Path=Routes, Mode=TwoWay}" IsSynchronizedWithCurrentItem="False"/>
        </DataTemplate>
        <DataTemplate x:Key="cellLength">
            <TextBox Text="{Binding Path=length}" />
        </DataTemplate>
        <DataTemplate x:Key="cellLengthZ">
            <TextBox Text="{Binding Path=free_length}" />
        </DataTemplate>
        <DataTemplate x:Key="cellReis">
            <TextBox Text="{Binding Path=reis}" />
        </DataTemplate>
        <DataTemplate x:Key="cellColumn2">
            <TextBox Text="{Binding Path=price}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellWorkTime">
            <TextBox Text="{Binding Path=WORK_TIME}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellRestTime">
            <TextBox Text="{Binding Path=rest_time}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellReisFact">
            <TextBox Text="{Binding Path=reis_fact}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellLengthFact">
            <TextBox Text="{Binding Path=length_fact}" />
        </DataTemplate>
        <DataTemplate x:Key="cellLengthZFact">
            <TextBox Text="{Binding Path=free_length_fact}" />
        </DataTemplate>
        <DataTemplate x:Key="cellPriceFact">
            <TextBox Text="{Binding Path=price_fact}" />
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Name="stackPanel2" Orientation="Horizontal" >
            <Button Content="Добавить" Height="23" Name="buttonAddInfo" Width="75" Click="buttonAddInfo_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDeleteInfo" Width="75" Click="buttonDeleteInfo_Click" />
            <Button Visibility="Hidden" Content="Редактировать" Height="23" Name="buttonEditInfo" Width="103" Click="buttonEditInfo_Click" />
        </StackPanel>
        <ListView Grid.Row="1" Name="listViewInfo" ItemsSource="{Binding Source={StaticResource sourceInfo}}">
            <ListView.View>
                <GridView>
                    <!-- <GridViewColumn Header="Выкл." Width="30" CellTemplate="{StaticResource cellDel}"/> -->
                    <GridViewColumn Header="Маршрут" Width="100" CellTemplate="{StaticResource cellRoute}"/>
                    <GridViewColumn Header="Пробег" Width="70" CellTemplate="{StaticResource cellLength}"/>
                    <GridViewColumn Header="Пробег Ф." Width="70" CellTemplate="{StaticResource cellLengthFact}"/>
                    <GridViewColumn Header="Проб. нул." Width="70" CellTemplate="{StaticResource cellLengthZ}"/>
                    <GridViewColumn Header="Проб. нул.Ф." Width="70" CellTemplate="{StaticResource cellLengthZFact}"/>
                    <GridViewColumn Header="Рейсы" Width="70" CellTemplate="{StaticResource cellReis}"/>
                    <GridViewColumn Header="Рейсы Ф." Width="70" CellTemplate="{StaticResource cellReisFact}"/>
                    <GridViewColumn Header="Доход" Width="70" CellTemplate="{StaticResource cellColumn2}"/>
                    <GridViewColumn Header="Доход Ф." Width="70" CellTemplate="{StaticResource cellPriceFact}"/>
                    <GridViewColumn Header="Раб. (ч)." Width="70" CellTemplate="{StaticResource cellWorkTime}"/>
                    <GridViewColumn Header="Отдых(ч)" Width="70" CellTemplate="{StaticResource cellRestTime}"/>
                </GridView>
            </ListView.View>
        </ListView>

    </Grid>
</UserControl>
